#include "mbook.h"

MBook::MBook()
{
}
MBook::MBook(int floor, int atk, int def){
    if(floor<9&&floor>=0){
        int damage1;
       if(atk-1>=35){damage1=0;}
       else if(atk<=1){damage1=999999;}
       else{damage1=(35/(atk-1)-!(35%(atk-1)))*(18-def);if(damage1<0){damage1=0;}}
       int damage2;
      if(atk-2>=45){damage2=0;}
      else if(atk-2<=0){damage2=999999;}
      else{damage2=(45/(atk-2)-!(45%(atk-2)))*(20-def);if(damage2<0){damage2=0;}}
      int damage3;
     if(atk-8>=60){damage3=0;}
     else if(atk-8<=0){damage3=999999;}
     else{ damage3=(60/(atk-8)-!(60%(atk-8)))*(32-def);if(damage3<0){damage3=0;}}
     int damage4;
    if(atk-3>=35){damage4=0;}
    else if(atk-3<=0){damage4=999999;}
    else{ damage4=(35/(atk-3)-!(35%(atk-3)))*(38-def);if(damage4<0){damage4=0;}}
    int damage5;
   if(atk-6>=50){damage5=0;}
   else if(atk-6<=0){damage5=999999;}
   else{ damage5=(50/(atk-6)-!(50%(atk-6)))*(42-def);if(damage5<0){damage5=0;}}
   int damage6;
  if(atk-3>=130){damage6=0;}
  else if(atk-3<=0){damage6=999999;}
  else{ damage6=(130/(atk-3)-!(130%(atk-3)))*(60-def);if(damage6<0){damage6=0;}}
  int damage7;
 if(atk-12>=55){damage7=0;}
 else if(atk-12<=0){damage7=999999;}
 else{  damage7=(55/(atk-12)-!(55%(atk-12)))*(52-def);if(damage7<0){damage7=0;}}
 int damage8;
if(atk-22>=50){damage8=0;}
else if(atk-22<=0){damage8=999999;}
else{ damage8=(50/(atk-22)-!(50%(atk-22)))*(48-def);}if(damage8<0){damage8=0;}
int damage9;
if(atk-110>=100){damage9=0;}
else if(atk-110<=0){damage9=999999;}
else{ damage9=(100/(atk-110)-!(100%(atk-110)))*(180-def);if(damage9<0){damage9=0;}}

       Information=QString(
                   "******Name***********Hp*Atk*Def*Coin*Exp**Damage<br>"
                   "***Green Slime*******35**18***1****1***1**%1<br>"
                   "****Red Slime********45**20***2****1***1**%2<br>"
                   "*****Priest**********60**32***8****5***6**%3<br>"
                   "********Bat**********35**38***3****3***2**%4<br>"
                   "*****Skeleton********50**42***6****6***5**%5<br>"
                   "****Big Slime*******130**60***3****8***4**%6<br>"
                   "Skeleton Soldier*****55**52**12****8***6**%7<br>"
                   "**Gate-Keeper C******50**48**22***12***8**%8<br>"
                   "**Gate-Keeper B*****100*180*110**100**80**%9<br>"
                   )

                       .arg(damage1,6,10,QChar(' '))
                       .arg(damage2,6,10,QChar(' '))
                       .arg(damage3,6,10,QChar(' '))
                       .arg(damage4,6,10,QChar(' '))
                       .arg(damage5,6,10,QChar(' '))
                       .arg(damage6,6,10,QChar(' '))
                       .arg(damage7,6,10,QChar(' '))
                       .arg(damage8,6,10,QChar(' '))
                       .arg(damage9,6,10,QChar(' '));

               ;}
    else if(floor==9){//计算伤害
        int damage3;
        if(atk-8>=60){damage3=0;}
        else if(atk-8<=0){damage3=999999;}
        else{ damage3=(60/(atk-8)-!(60%(atk-8)))*(32-def);if(damage3<0){damage3=0;}}
        int damage5;
       if(atk-6>=50){damage5=0;}
       else if(atk-6<=0){damage5=999999;}
       else{ damage5=(50/(atk-6)-!(50%(atk-6)))*(42-def);if(damage5<0){damage5=0;}}
        int damage7;
       if(atk-12>=55){damage7=0;}
       else if(atk-12<=0){damage7=999999;}
       else{  damage7=(55/(atk-12)-!(55%(atk-12)))*(52-def);if(damage7<0){damage7=0;}}
       int damage9;
      if(atk-15>=100){damage9=0;}
      else if(atk-15<=0){damage9=999999;}
      else{ damage9=(100/(atk-15)-!(100%(atk-15)))*(65-def);if(damage7<0){damage9=0;}}
        Information=QString(
                    "********Name*********Hp*Atk*Def*Coin*Exp**Damage<br>"
                    "*******Priest********60**32**8****5***6**%1<br>"
                    "******Skeleton*******50**42**6****6***5**%2<br>"
                    " Skeleton Soldier****55**52*12****8***6**%3<br>"
                    " Skeleton Captain***100**65*15***30**35**%5<br>")
                .arg(damage3,6,10,QChar(' '))
                .arg(damage5,6,10,QChar(' '))
                .arg(damage7,6,10,QChar(' '))
                .arg(damage9,6,10,QChar(' '));


    }
}
